﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;
using models;

namespace yuejilalala
{
    public partial class regiest : System.Web.UI.Page
    {
        UserMarager manager = new UserMarager();
        decimal sjh;
        int mobile_code;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
            }
           
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            if (CheckBox1.Checked)
            {
                User user = new User();
                sjh = decimal.Parse(mobile.Text);
                mobile_code = int.Parse(Session["mobile_code"].ToString());
                if (TextBox1.Text == mobile_code.ToString())
                {
                    user.Uid = tb_uid.Text;
                    user.UName = "";
                    user.Sex = "";
                    user.Birthday = "";
                    user.Email = "";
                    user.Pwd = tb_mm.Text;
                    user.Phone = sjh;
                    int id = user.Id;
                    if (tb_mm.Text == tb_qrmm.Text)
                    {
                        manager.AddUser(user);
                        Response.Write("<script>alert('注册成功')</script>");
                        Response.Redirect("Login.aspx");
                    }
                    else
                    {

                        Response.Write("<script>alert('两次密码不一致')</script>");
                    }
                }
            }
            else
            {
                Response.Write("<script>alert('请勾选《服务协议》')</script>");
            }
        }
    }
}